function(ff_create_strversionnumber)

execute_process(COMMAND "date" OUTPUT_VARIABLE VersionFreeFemDate)
string(STRIP ${VersionFreeFemDate} VersionFreeFemDate)
file(WRITE ${CMAKE_SOURCE_DIR}/src/fflib/strversionnumber.cpp
"// TODO: remove this block as soon as autoconf is removed from FreeFEM\n
#ifndef CMAKE\n
#include \"config-wrapper.h\"\n
#endif\n
\n
#include \"strversionnumber.hpp\" // [[file:strversionnumber.hpp]] \n
#include <cstdlib> \n
using namespace std;\n
#define TOSTRING1(i) #i \n
#define TOSTRING(i) TOSTRING1(i) \n
\n
//#include <sstream>\n
#include <cstdio>\n
using namespace std;\n
\n
double VersionNumber(){\n
  #define VersionFreeFem ${FREEFEM_VERSION} // Generated by CMake \n
  return VersionFreeFem;\n
}\n
\n
string StrVersionNumber(){\n
//  std::ostringstream buffer;\n
//  buffer.precision(8);\n
//  buffer<<VersionNumber();\n
  static char buffer[100];\n
  sprintf(buffer,\" %9f (date ' ${VersionFreeFemDate}')\",VersionNumber());\n
  return buffer; //.str()+\" (date ${VersionFreeFemDate})\" ;\n
}")



endfunction(ff_create_strversionnumber)
